package com.overlord.im.commons.message;

import io.netty.buffer.ByteBuf;

import java.io.IOException;

/**
 * @author wuwei
 * @className MessageProtocolConverter
 * @description
 * @date 2020/5/29 11:56
 **/
public interface MessageProtocolConverter {

    /**
     * 编码
     *
     * @param out
     * @param message
     * @throws IOException
     */
    void encode(final ByteBuf out, final OverlordImMessage message) throws IOException;

    /**
     * 解码
     *
     * @param in
     * @param version
     * @param type
     * @param ackTypeCode
     * @param systemType
     * @param messageId
     * @return
     * @throws IOException
     */
    OverlordImMessage decode(ByteBuf in, int version, int type, int ackTypeCode, byte systemType, Long messageId) throws IOException;

}
